package main

func main() {
	s := someStruct{name: "example"}
	foo(s)
}

// 泛型约束
func foo[T someInterFaceA](p T) {
	p.doSomethingA()
	// 泛型类型参数不能直接做类型断言（p.(someInterFaceA)），
	// if isA, ok := p.(someInterFaceA); ok {
	// 	isA.doSomethingA()
	// }
}

type someInterFaceA interface {
	doSomethingA()
}

type someStruct struct {
	name string
}

func (s someStruct) doSomethingA() {
	println("A: Doing something with", s.name)
}
